using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BgControl : MonoBehaviour
{
    // 背景速度
    public float Speed = 0.4f;

    void Update()
    {
        if(PlayerControl.hp == 0){
            return;
        }
        // 遍历背景，子物体
        foreach(Transform tran in transform){
            Vector3 pos = tran.position;
            pos.x -= Speed * Time.deltaTime;
            if(pos.x < -7.2f){
                pos.x += 7.2f * 2;
            }
            tran.position = pos;
        }
    }
}
